#ifndef OGREWIDGET_H
#define OGREWIDGET_H

#include <QPaintDevice>
#include <QWidget>

#include <OgreRoot.h>
#include <OgreRenderWindow.h>
#include <OgreSceneManager.h>

using Ogre::Root;
using Ogre::RenderWindow;
using Ogre::SceneManager;
using Ogre::LogManager;
using Ogre::Real;
using Ogre::Camera;
using Ogre::Viewport;
using Ogre::Vector3;
using Ogre::ColourValue;
using Ogre::TextureManager;

class OgreWidget : public QWidget, public Ogre::FrameListener, public Ogre::RenderSystem::Listener
{
    Q_OBJECT

public:
    OgreWidget(QWidget *parent);
    ~OgreWidget();
    
    void UpdateOgre();
    
    void eventOccurred (const Ogre::String& eventName, const Ogre::NameValuePairList* parameters=0);
    QPaintEngine* paintEngine() const;
    
    SceneManager* sceneManager;
    Camera* camera;
    Viewport* viewport;

protected:
    Root* root;
    RenderWindow* renderWindow;

    void SetupOgre();
    void paintEvent(QPaintEvent* evt);
    void resizeEvent(QResizeEvent* evt);

private:
    bool screenResized;
    bool stopRendering;
};

#endif // OGREWIDGET_H
